﻿using ATM.Entities;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ATM.DAO;
using ATM.BUS;

namespace ATM.UnitTest
{
    [TestFixture()]
    class WithdrawUT
    {
        private Card card;
        private Account acc;
        private float amount;

        [SetUp]
        protected void SetUp()
        {
            card = CardDAO.GetCurrentCard("123456789ABCDEFG");
            acc = AccountDAO.GetCurrentAccount(card);
        }

        [TestCase]
        public void TestCase1()
        {
            amount = 19000000;
            Assert.AreEqual(4, WithdrawBUS.Withdraw(amount, acc, card, 1));
        }

        [TestCase]
        public void TestCase2()
        {
            amount = acc.Balance+50000;
            Assert.AreEqual(3, WithdrawBUS.Withdraw(amount, acc, card, 1));
        }

        [TestCase]
        public void TestCase3()
        {
            amount = 500000;
            Assert.AreEqual(2, WithdrawBUS.Withdraw(amount, acc, card, 1));
        }

        [TestCase]
        public void TestCase4()
        {
            amount = 30000000;
            Assert.AreEqual(1, WithdrawBUS.Withdraw(amount, acc, card, 1));
        }

        [TestCase]
        public void TestCase5()
        {
            amount = 60000;
            Assert.AreEqual(0, WithdrawBUS.Withdraw(amount, acc, card, 1));
        }
    }
}
